<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .container {
            border: 1px solid #cccccc;
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
            grid-template-rows: repeat(2, 100px)
        }

        .container>div:nth-child(2n) {
            background-color: pink;
        }

        .container>div:nth-child(2n+1) {
            background-color: skyblue;
        }
    </style>
</head>

<body>
    <div class="container">
        <div>1</div>
        <div>2</div>
        <div>3</div>
        <div>4</div>
        <div>5</div>
        <div>6</div>
    </div>
    <button>按钮</button>
</body>
<script>
    const arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]

   var fn = (num) => {
        const result = arr.filter(() => Math.random() > 0.5)
        result.length = num
        
        return result
        
    }
   console.log(fn(5));
    // var btn=document.querySelector('button')
    // btn.onclick=()=>{
    //     console.log(1);
    // }
    // function ss(x){
    //     return x+5
    // }
    // var res=ss(3)
    // console.log(res);
    var res=(x)=>{
        return x+5
    }
    console.log(res(5));
    var n=Math.random()
    console.log(n);
    var brr=[1,2,3,4,5]
    var res1=brr.filter((item)=>{
       return  item>3
    })
    console.log(res1);
   
</script>

</html>